#ifndef HALOKPY_H
#define HALOKPY_H

#include <QMainWindow>
#include <QVBoxLayout>
#include <QComboBox>
#include <QDateTime>
#include <QStandardItemModel>

#include "database.h"

#include "ganttmodel.h"
#include "publicstruct.h"
#include "taskbyproject.h"

namespace KDGantt {
class View;
}

QT_BEGIN_NAMESPACE
namespace Ui { class HaloKpy; }
QT_END_NAMESPACE

class HaloKpy : public QMainWindow
{
    Q_OBJECT

public:
    HaloKpy(QWidget *parent = nullptr);
    ~HaloKpy();

    void initComboBoxData(QComboBox *cbox, const QString &dataType,const QString &dataCondition);
private slots:

    void initDeveloperTaskGnt();
    void initProjectTaskGnt();
//    QMap<QString, QString> getDataDictFrSqlite();
//    bool getTaskesTimateFrTaskId(QString &tasksId, QDate &startDate, QDate &endDate);

//    QStringList getComboBoxDataBySql(const QString &sqlStr);
//    void getPagingInfo(QPageBar *pageBar/*,QString strSql*//*,int pageSize*/);
    void initPersonPie(QList<PersonHours> &hoursList);
//    QList<PersonHours> getPersonHours(QString &userName, QDate &startDate, QDate &endDate);
    void on_actionProjectTaskGnt_triggered();
    void on_actionPersonTaskGnt_triggered();
    void on_btn_devtaskgnt_qry_clicked();
    void reflashPagingModelView_new(GanttModel *prjGntModel,int curPage);
//    QList<GanttTask> getTaskDataByPrjName_new(QPageBar *pageBar/*,int curPage*/);
//    QList<GanttTask> getTaskDataByDevName_new(QPageBar *pageBar/*,int curPage*/);
    void on_btnPrjTaskQuery_clicked();

    void on_actionDeptDevHours_triggered();
    void initDeptDevHours();
    void on_combQuickDate_currentTextChanged(const QString &arg1);
    void on_btnQueryHours_clicked();
    void on_tabTotalHours_doubleClicked(const QModelIndex &index);

/*    QList<DeptDevTotalHours> getDeptDevTotalHours(QString &startDate, QString &endDate);
    QList<DevDetailHours> getDevDetailHours(QString &userName,QString &startDate, QString &endDate);*/
    void ShowTooltip(QModelIndex index);
    void on_actionVerPlan_triggered();
    void initProjectVerPlan();
    void  slotRowDoubleClicked(const QModelIndex index);
    void on_btnQureyVerPlan_clicked();

    void on_combProductName_currentTextChanged(const QString &arg1);

    void on_combVerPlan_currentTextChanged(const QString &arg1);

    void on_btnExportHours_clicked();

    void on_actionAttendance_triggered();

    void on_action_checkUpdate_triggered();

private:
    Ui::HaloKpy *ui;


    database *dbSqlite;

    KDGantt::View view;
    KDGantt::DateTimeGrid grid;
    QSlider slider;
    QStandardItemModel model;
    KDGantt::ConstraintModel cmodel;
    QVBoxLayout *mlayout;
public:
    QList<PrjVerPlan> m_prjVerPlan;
    GanttModel* m_projectTaskGnt,*m_developerTaskGnt,*m_projectVerPlanGnt;
    QStandardItemModel* m_totalHoursModel,*m_detailHoursModel;
    QString m_versionNum;
    QString m_exeFileName;
    QString m_strRemoteUrl;
    TaskByProject *m_taskByProject;
    database *dbMySql;
};
#endif // HALOKPY_H
